package com.wica.action;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wica.bean.User;
import com.wica.mapper.BiddMapper;

@Controller
@RequestMapping("/")
public class BiddAction {
	
	@Autowired
	private BiddMapper mapper;
	public void setMapper(BiddMapper mapper) {
		this.mapper = mapper;
	}
	
	
	@RequestMapping("check")
	public @ResponseBody Map<String,Object> check(String name){
		Map<String,Object> map = new HashMap<String, Object>();
		
		User user = mapper.login(name);
		
		if(user  ==null) {
			map.put("sta", 1);
		}else {
			map.put("sta", 0);
		}
		
		return map;
	}
	
	@RequestMapping("login")
	public String login() {
		
		
		return "add";
	}
	
	
}
